package com.lee.enjoy221113_retrofit;

/**
 * @ProjectName: LifeCycleTest
 * @Package: com.lee.enjoy221113_retrofit
 * @ClassName: ParameterHandler
 * @Description: java类作用描述
 * @Author: 李占伟
 * @CreateDate: 2022/11/14 15:27
 * @UpdateUser: 更新者
 * @UpdateDate: 2022/11/14 15:27
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */

public abstract class ParameterHandler {
    //构造方法接收key

    public abstract void apply(ServiceMethod serviceMethod,String value);

    static class FieldParameterHandler extends ParameterHandler{
        private String key;

        public FieldParameterHandler(String key) {
            this.key = key;
        }

        @Override
        public void apply(ServiceMethod serviceMethod, String value) {
            serviceMethod.addFieldParameter(key,value);
        }
    }
    static class QueryParameterHandler extends ParameterHandler{
        private String key;

        public QueryParameterHandler(String key) {
            this.key = key;
        }

        @Override
        public void apply(ServiceMethod serviceMethod, String value) {
            serviceMethod.addQueryParameter(key,value);
        }
    }
}
